home *** CD-ROM | disk | FTP | other *** search
- Path: fohnix.metronet.com!not-for-mail
- From: milam@fohnix.metronet.com (Stan Milam)
- Newsgroups: comp.lang.c
- Subject: Re: Getting date in UNIX
- Date: 25 Mar 1996 13:23:31 -0600
- Organization: Texas Metronet, Inc (login info (214/488-2590 - 817/571-0400))
- Message-ID: <4j6rrj$2bf@fohnix.metronet.com>
- References: <4ik447$bn7@raffles.technet.sg>
- NNTP-Posting-Host: fohnix.metronet.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- Leonard Sim (leonard@pacific.net.sg) wrote:
- : Can anyone please inform me how to obtain the date in UNIX C??
- : I just need the date in this format "dd/mm/yyyy". Thanks!!!
-
-
- : rdgs,
-
- : Leonard Sim
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
-
- int main( void ) {
-
- time_t time_v;
- char buffer[80], format[] ="%d/%m/%Y";
-
- time( &time_v );
- strftime( buffer, sizeof(buffer), format, localtime( &time_v ) );
- puts( buffer );
- return EXIT_SUCCESS;
- }
-